package com.example.springboot2.xdkt.controller;

import com.example.springboot2.xdkt.domain.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

//返回json格式，不需要每个方法都加@RequestBody
@RestController
public class SampleController {

    @RequestMapping("/test")
//    @ResponseBody
    public Map<String, String> testMap() {
        Map<String, String> map = new HashMap<>();
        map.put("name", "xdclass");
        return map;
    }

    @RequestMapping("/testJson")
    public Object testJson() {

        return new User(11,"abc",100L,new Date());
    }


}

